project(qtapictpimpl)
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
  
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ")

IF (WIN32)
	MESSAGE(STATUS "###########################OS is windows###########################")

	INCLUDE_DIRECTORIES(
			./include
			./include/common/
			#./include/Femas_win64_V3.02/
			./include/ctp/v6.3.13_20181119_traderapi_win/20181119_tradeapi64_se_windows/
			#./include/qtapi/
			./include/tinyxml/
			./include/spdlog/include/
	)
    link_directories(
            ./lib/linux/
			#./include/Femas_win64_V3.02/
			./include/ctp/v6.3.13_20181119_traderapi_win/20181119_tradeapi64_se_windows/
		#	./include/qtapi/
    )
	
ELSEIF (UNIX)	
	MESSAGE(STATUS "###########################OS is UNIX-like OS's.###########################")

    include_directories(
           ./include
		   ./include/common/
		   #./include/Femas_lnx64_V3.02/
			./include/ctp/v6.3.15_20190220_api_tradeapi_se_linux64/
			./include/rem/v_3.1.3.65_linux64/
		   ./include/qtapi/
		   ./include/tinyxml/
		   ./include/spdlog/include/
    )

    link_directories(
            ./lib/linux/
			#./include/Femas_lnx64_V3.02/
			./include/ctp/v6.3.15_20190220_api_tradeapi_se_linux64/
			./include/rem/v_3.1.3.65_linux64/
			./include/qtapi/
    )


ENDIF ()


SET(Femas_SOURCES 
include/tinyxml/tinystr.cpp
include/tinyxml/tinyxml.cpp
include/tinyxml/tinyxmlerror.cpp
include/tinyxml/tinyxmlparser.cpp
include/tinyxml/xmltest.cpp
include/tinyxml/tinystr.h
include/tinyxml/tinyxml.h
include/BlowFish.h
include/Config.h
include/gcc_Debug.h
include/gcc_Release.h
include/mylogger.h
include/mystruct.h
include/TradeSpi.h
include/RemTrade.h
src/BlowFish.cpp
src/Config.cpp
src/mylogger.cpp
#src/TradeSpi.cpp
src/RemTrade.cpp
include/AllMarketData.h
#src/AllMarketData.cpp
include/InstrumentMarketData.h
#src/InstrumentMarketData.cpp
include/MdSpi.h
#src/MdSpi.cpp
)

ADD_LIBRARY(${PROJECT_NAME} SHARED ${Femas_SOURCES})

#ADD_EXECUTABLE(${PROJECT_NAME}_test src/test_case.cpp )
IF (WIN32)
	MESSAGE(STATUS "###########################OS is windows###########################")

    target_link_libraries(${PROJECT_NAME} 
	#USTPmduserapiAF64.lib
	#USTPtraderapiAF64.lib
			thostmduserapi_se.lib
			thosttraderapi_se.lib
#	libqtapi.so
            )
			
    target_link_libraries(${PROJECT_NAME}_test  ${PROJECT_NAME} 
	#USTPmduserapiAF64.lib
	#USTPtraderapiAF64.lib
			thostmduserapi_se.lib
			thosttraderapi_se.lib
#	libqtapi.so
            )

ELSEIF (UNIX)
	MESSAGE(STATUS "###########################OS is UNIX-like OS's.###########################")

	target_include_directories(${PROJECT_NAME}
			PUBLIC ./include/qtapi/
	)
    target_link_libraries(${PROJECT_NAME} 
	#libUSTPtraderapiAF.so
	#libUSTPmduserapiAF.so
			libthostmduserapi_se.so
			libthosttraderapi_se.so
			libEESTraderApi.so
     #   	libqtapi.so
            )


set( target_rem  ${Femas_SOURCES}
     ./src/qtapi.cpp    
     ./src/rem_test.cpp)


 FILE(GLOB_RECURSE  g_target_rem  ${target_rem} )
add_executable(rem_trade ${g_target_rem})
target_link_libraries(rem_trade libEESTraderApi.so  pthread)



	

ENDIF ()
